home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Info-Mac 3
/
Info_Mac_1994-01.iso
/
Development
/
Source
/
MSG Graphic Effects 1.0 Source
/
Split scroll U-D.c
< prev
next >
Wrap
Text File
|
1993-08-23
|
3KB
|
93 lines
/*******************************************************************************
* Copyright © 1992-1993 Mark Pilgrim *
* *
* This file is provided as is, and may be freely distributed unaltered. This *
* message must accompany any copy of this file. This file may be used or *
* modified for use for a non-commercial product provided that appropriate *
* credit is given to the author named above. *
* Commercial use of this source code is prohibited. *
******************************************************************************/
#include "msg misc.h"
#include "msg timing.h"
#define BoxSize 10
#define CorrectTime 4
void SplitScrollUD(GrafPtr);
/* Draw a line from the topleft to the bottomright of the screen and split the
screen into two regions. The top region scrolls down and the bottom region
scrolls up. */
void SplitScrollUD(GrafPtr sourceGrafPtr)
{
int x;
Rect theTopRect, topdest, theBottomRect, bottomdest;
Rect topscrollsource, topscrolldest, bottomscrollsource, bottomscrolldest;
RgnHandle toprgn,bottomrgn;
toprgn=NewRgn();
SetEmptyRgn(toprgn);
MoveTo(0,0);
OpenRgn();
Line(MAIN_WINDOW_WIDTH,0);
Line(0,MAIN_WINDOW_HEIGHT);
LineTo(0,0);
CloseRgn(toprgn);
bottomrgn=NewRgn();
SetEmptyRgn(bottomrgn);
MoveTo(0,0);
OpenRgn();
Line(0,MAIN_WINDOW_HEIGHT);
Line(MAIN_WINDOW_WIDTH,0);
LineTo(0,0);
CloseRgn(bottomrgn);
topscrollsource=gMainWindow->portRect;
topscrollsource.bottom-=BoxSize;
topscrolldest = topscrollsource;
OffsetRect(&topscrolldest, 0, BoxSize);
topdest = gMainWindow->portRect;
topdest.bottom=BoxSize;
theTopRect.top=MAIN_WINDOW_HEIGHT-BoxSize;
theTopRect.bottom=MAIN_WINDOW_HEIGHT;
theTopRect.left=0;
theTopRect.right=MAIN_WINDOW_WIDTH;
bottomscrollsource=gMainWindow->portRect;
bottomscrollsource.top+=BoxSize;
bottomscrolldest=bottomscrollsource;
OffsetRect(&bottomscrolldest, 0, -BoxSize);
bottomdest=gMainWindow->portRect;
bottomdest.top=bottomdest.bottom-BoxSize;
theBottomRect.top=0;
theBottomRect.bottom=BoxSize;
theBottomRect.left=0;
theBottomRect.right=MAIN_WINDOW_WIDTH;
for(x = MAIN_WINDOW_HEIGHT - BoxSize; x >= 0; x -= BoxSize)
{
StartTiming();
CopyBits(&(gMainWindow->portBits), &(gMainWindow->portBits),
&topscrollsource, &topscrolldest, 0, toprgn);
CopyBits(&(sourceGrafPtr->portBits), &(gMainWindow->portBits),
&theTopRect, &topdest, 0, toprgn);
theTopRect.bottom-=BoxSize;
theTopRect.top-=BoxSize;
CopyBits(&(gMainWindow->portBits), &(gMainWindow->portBits),
&bottomscrollsource, &bottomscrolldest, 0, bottomrgn);
CopyBits(&(sourceGrafPtr->portBits), &(gMainWindow->portBits),
&theBottomRect, &bottomdest, 0, bottomrgn);
theBottomRect.top+=BoxSize;
theBottomRect.bottom+=BoxSize;
TimeCorrection(CorrectTime);
}
}